#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int a = 0, b = 0, c = 0, d = 0;
	for (a = 0; a < 2; a++)
	{
		for (b = 0; b < 2; b++)
		{
			for (c = 0; c < 2; c++)
			{
				for (d = 0; d < 2; d++)
				{
					if (a == 1 && c == 1 && d == 1 && d == 0 && (a + b + c + d == 1))
						printf("a");
					if (a == 0 && c == 0 && d == 1 && d == 0 && (a + b + c + d == 1))
						printf("b");
					if (a == 0 && c == 1 && d == 0 && d == 0 && (a + b + c + d == 1))
						printf("c");
					if (a == 0 && c == 1 && d == 1 && d == 1 && (a + b + c + d == 1))
						printf("d");
				}
			}
		}
	}
}


void test(char* p, int a, int str)
{
	char arr2[10] = { 0 };
	int i = 0;
	for (i = 0; i < a; i++)
	{
		arr2[i] = *(p + i);
	}
	for (i = a; i < str; i++)
	{
		*(p + i - a) = *(p + i);
	}
	for (i = 0; i < a; i++)
	{
		*(p + str - a + i) = arr2[i];
	}
}
#include<stdio.h>                                                                             
#include<string.h>
int main()
{
	char arr[] = "abcde";
	int str = strlen(arr);
	int a = 0;
	scanf("%d", &a);
	test(arr, a, str);
	printf("%s\n", arr);
	return 0;
}

#include<string.h>
int test(char arr1[],char arr2[])
{
	int len = strlen(arr1);
	int i = 0, j = 0;
	for (i = 0; i < len; i++)
	{
		char a = arr1[0];
		for (j = 0; j < len-1; j++) 
		{
			arr1[j] = arr1[j + 1];
		}
		arr1[len - 1] = a;
		if (strcmp(arr1, arr2) == 0)
			return 1;
		if (i == len - 1)
			return 0;
	}
}
#include<stdio.h>
int main()
{
	char arr1[] = {"abcd"};
	char arr2[] = { "bcda" };
	int flag = test(arr1,arr2);
	printf("%d\n", flag);
	return 0;
}


#include<stdio.h>
int main()
{
	int n = 0, m = 0;
	int arr[10][10] = { 0 };
	scanf("%d%d", &n, &m);
	int i = 0, j = 0;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < m; j++)
		{
			scanf("%d", &arr[i][j]);
		}
	}
	printf("\n");
	for (j = 0; j < m; j++)
	{
		for (i = 0; i < n; i++)
		{
			printf("%d ", arr[i][j]);
		}
		printf("\n");
	}
	return 0;
}

#include<stdio.h>
int main()
{
	int n = 0;
	scanf("%d", &n);
	int arr[10][10] = { 0 };
	int i = 0, j = 0;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n; j++)
		{
			scanf("%d", &arr[i][j]);
		}
	}
	int a = n;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < i; j++)
		{
			if (arr[i][j] != 0)
			{
				printf("NO\n");
				return 0;
			}
		}
	}
	printf("YES\n");
	return 0;
}


#include<stdio.h>
int main()
{
	int n = 0;
	scanf("%d", &n);
	int arr[50] = { 0 };
	int i = 0;
	for (i = 0; i < n; i++)
	{
		scanf("%d", &arr[i]);
	}
	for (i = 0; i < n-1; i++)
	{
		if (arr[i] > arr[i + 1])
		{
			printf("unsorted");
			return 0;
		}
	}
	printf("soorted");
	return 0;
}